package com.scmt.hmzd.enums;

public enum OrderEnum {
    ORDER_DEFAULT("订单初始状态", 0),
    ORDER_PAY("已支付", 1),
    ORDER_OPERATION("技师接单", 2),
    ORDER_WAY("技师路途中", 3),
    ORDER_ARRIVES("技师到达", 4),
    ORDER_SERVICE("开始服务", 5),
    ORDER_STOP("服务结束", 6),
    ORDER_COMMON("已评论", 7),
    ORDER_CANCEL("订单关闭失效", -1),
    ORDER_ERROR("支付失败", -2);



    // 成员变量
    private String name;
    private int index;


    // 构造方法
    private OrderEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (OrderEnum c : OrderEnum.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static int getIndex(String name) {
        for (OrderEnum c : OrderEnum.values()) {
            if (c.getName().equals(name)) {
                return c.index;
            }
        }
        return 0;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
